//
//  并查集.swift
//  Swift-LeetCode
//
//  Created by 卢悦明 on 2024/3/2.
//

import UIKit

class UnionFind {
    
     var parents: [Int] = []
    
    /// 初始化
    /// - Parameter length: 节点数
    init(_ length: Int) {
        for index in 0..<length {
            parents.append(index)
        }
    }
    
    func find(_ v: Int) -> Int {
        v
    }
    func union(_ v1: Int, _ v2: Int) {
        
    }
    
    /// 判断v1和v2是否属于同一集合
    /// - Parameters:
    ///   - v1:1
    ///   - v2: =
    /// - Returns: 结果
    func isSame(_ v1: Int, _ v2: Int) -> Bool {
        find(v1) == find(v2)
    }
}




